package com.gsnd.gsnd22estore.service.impl;

import com.gsnd.gsnd22estore.domain.EsShopcar;
import com.gsnd.gsnd22estore.dto.ShopCarInfoDto;
import com.gsnd.gsnd22estore.mapper.EsShopcarMapper;
import com.gsnd.gsnd22estore.service.ShopCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopCarServiceImpl implements ShopCarService {
    @Autowired
    EsShopcarMapper shopcarMapper;

    @Override
    public List<ShopCarInfoDto> getShopCarByUser(Integer userId) {
        return shopcarMapper.select(userId);
    }

    @Override
    public void removeBookInfoInShopCar(List<Integer> ids) {
        shopcarMapper.deleteBatch(ids);
    }

    @Override
    public void addBookToShopCar(EsShopcar shopCar) {
        shopcarMapper.insert(shopCar);
    }

    @Override
    public void modifyShopCar(EsShopcar shopCar) {
        shopcarMapper.update(shopCar);
    }
}
